﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AspNetCs.Bll;
using AspNetCs.Model;
using AspNetCs.Common;

public partial class Users_AddUserLink : BasePage
{
    protected string ChannelId = "";
    protected int Typeid = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserExit("Login.Aspx?ReUrl=" + configInfo.InstallDir + "Users/AddUserLink.Aspx", "请您登录", true);
        if (Request["ChannelId"] != null)
        {
            ChannelId = Request["ChannelId"].ToString();
        }
        if (Request["Types"] != null)
        {
            Typeid = StringHelper.isNumber_int(Request["Types"].ToString());
        }
        if (Typeid <= 0)
        {
            Response.Write("参数错误!");
            Response.End();
        }
        if (!Page.IsPostBack)
        {
            if (Request["Rurl"] != null)
            {
                ViewState["ReUrl"] = Request["Rurl"].ToString();
            }
        }


    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        FriendSite_Model model = new FriendSite_Model();
        model.SiteName = StringHelper.HtmlEncrypt(Txt_LinkName.Text);
        model.LinkType = 2;
        model.SiteUrl = StringHelper.HtmlEncrypt(Txt_linkUrl.Text);
        model.SiteIntro = StringHelper.HtmlEncrypt(Txt_Readme.Text);
        model.SiteAdmin = Base_GetLoginInfo.GetUserName;
        model.IsGood = 0;
        model.IsCheck = 1;
        model.Channel = ChannelId;
        model.TypeId = Typeid;
        model.Email = Base_GetLoginInfo.GetEmail;
        int Result = FriendSite_Bll.CreateNew.Add(model);
        if (Result > 0)
        {
            Response.Write("<script>alert('添加成功!');parent.location.href='" + ViewState["ReUrl"].ToString() + "';</script>");
            Response.End();

        }






    }
    protected void Button2_Click(object sender, EventArgs e)
    {

    }
}
